package com.cskaoyan.dbutills.resultset;

import com.cskaoyan.bean.Account;
import com.cskaoyan.bean.Account2;
import com.cskaoyan.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * 创建日期: 2022/10/11 15:02
 *
 * @author ciggar
 */
public class BeanHandlerDemo {

    public static void main(String[] args) throws SQLException {


        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        Account2 account2  = queryRunner.query("select id,name as username,money from account where id = ?",new BeanHandler<>(Account2.class),1001);

        System.out.println(account2);

    }


}
